/**
* @depends jquery.ui.js
*/

(function($) {

	$.widget( 'ui.tooltip', {
		
		_init: function() {
		
			var $this = this;
		
			var tip = $('<div class="ui-tip">' + this.options.tip + '</div>' );
			this.element.append( tip );
			
			var t;
			this.element
				.append( tip )
				.hover( function() {
					t = setTimeout( function() {
						tip.fadeIn();
					}, $this.options.delay );
				}, function() {
					if( t ) {
						clearTimeout( t );
						t = false;
					}
					tip.hide();
				} );
		},
		
		options: {
			delay: 500
		}
		
	} );
	
})(jQuery);
